package com.moco.launcher.dialog;

import com.moco.launcher.R;

import android.app.Dialog;
import android.content.Context;
import android.util.Log;
import android.view.Gravity;
import android.view.KeyEvent;
import android.view.MotionEvent;
import android.view.WindowManager;
import android.widget.TextView;

public class WaitDialog extends Dialog {
	


	static WaitDialog waitDialog;

	private WaitDialog(Context context) {
		super(context);
	}
	
	private WaitDialog(Context context,int styleId){
		super(context, styleId);
	}
	
	public static WaitDialog createDialog(Context context){  
    	waitDialog = new WaitDialog(context,R.style.CustomProgressDialog);  
    	waitDialog.setContentView(R.layout.wait_dialog);  
    	
    	WindowManager.LayoutParams lp = waitDialog.getWindow().getAttributes();
    	lp.gravity = Gravity.BOTTOM|Gravity.CENTER_HORIZONTAL; 
    	lp.verticalMargin=0.25f;
    	waitDialog.getWindow().setAttributes(lp);
    
        return waitDialog;  
    } 
    
    public void setMessage(String message){
    	if(waitDialog == null){
    		return;
    	}
    	TextView textView = (TextView) waitDialog.findViewById(R.id.showTxt);
    	textView.setText(message);
    }

	@Override
	public boolean onTouchEvent(MotionEvent event) {
		// TODO Auto-generated method stub
		waitDialog.dismiss();
		return super.onTouchEvent(event);
	}
	
}
